/**********************************************************************\

 Copyright 2012 Diggory Blake

 This file is part of klip-engine

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.

\**********************************************************************/
#pragma once

class kView;
class kCamera;
class kImage;
class kGraphics;

#include "kwatcher.h"
#include "kmath.h"

class kView : public kWatcher {
private:
	kGraphics* _graphics;
	kCamera* _camera;
	kImage* _renderTarget;
	kRect _viewport;
	kColor _backdrop;
	bool _backdropEnabled;
public:
	kView(kGraphics* graphics);
	kView(kGraphics* graphics, kImage* renderTarget);
	inline void setViewport(const kRect& viewport) {
		_viewport = viewport;
	}
	inline const kRect& getViewport() {
		return _viewport;
	}
	void setRenderTarget(kImage* renderTarget);
	inline kImage* getRenderTarget() {
		return _renderTarget;
	}
	inline void setCamera(kCamera* camera) {
		_camera = camera;
	}
	inline kCamera* getCamera() {
		return _camera;
	}
	inline void setBackdrop(const kColor& backdrop) {
		_backdrop = backdrop;
	}
	inline const kColor& getBackdrop() {
		return _backdrop;
	}
	inline void setBackdropEnabled(bool enabled) {
		_backdropEnabled = enabled;
	}
	inline bool getBackdropEnabled() {
		return _backdropEnabled;
	}
	void render(std::function<void (bool)> callback = 0);
};
